import requests

url = 'http://www.baidu.com'
response = requests.get(url)
response.encoding = 'utf-8'  # 设置编码
print(response.status_code)  # 响应状态码
headers = response.headers  # 响应头，字典
print(headers['content-type'])  

print(response.text)  # 响应体：文本
